package hn.cch.controller;


import org.springframework.cloud.gateway.webflux.ProxyExchange;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RequestMapping(value = "/proxy")
@RestController
public class ProxyController {


    @GetMapping(value = "/just")
    public Mono<ResponseEntity<byte[]>> just(ProxyExchange<byte[]> proxy,
                                             @RequestParam(value = "key") String key) {
        return proxy.uri("http://localhost:8888/mono/just?key=" + key).get();
    }

}
